/**
 * 
 */
package com.googlecode.gwtresume.client.widgets;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;

public class ListItem extends ComplexPanel implements HasText {
	
	
	public ListItem() {
		setElement(DOM.createElement("li"));
	}
	
	public ListItem(String title) {
		this();
		setText(title);
	}

	public ListItem(String style, String title) {
		this();
		setStylePrimaryName(style);
		setText(title);
	}

	public ListItem(String style, Widget widget) {
		this();
		setStylePrimaryName(style);
		add(widget);
	}




	public void add(Widget w) {
		super.add(w, getElement());
	}

	public void insert(Widget w, int beforeIndex) {
		super.insert(w, getElement(), beforeIndex, true);
	}

	public String getText() {
		return DOM.getInnerText(getElement());
	}

	public void setText(String text) {
		DOM.setInnerText(getElement(), (text == null) ? "" : text);
	}
	
	

}